<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //获取缓存信息
        console.log(sessionStorage.getItem('user'));//null
        console.log(localStorage.getItem('user'));//null

        // storage的事件,当另一页的storage改变时触发
        window.addEventListener('storage', (ev) => {
            console.log("storage事件触发了");
            console.log(ev);
        })
    </script>
</body>

</html>